package edu.bjfu.klotski;


import edu.bjfu.klotski.R;
import edu.bjfu.klotski.R.layout;
import edu.bjfu.klotski.R.menu;
import edu.bjfu.klotski.UI.CoverFlow;
import edu.bjfu.klotski.BLL.LayoutAdapter;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.support.v4.app.NavUtils;

public class LayoutManageActivity extends Activity {

	ImageButton btn_edit=null;
	ImageButton btn_delete=null;
	ImageButton btn_new=null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_layout_manage);
        
        CoverFlow cf = (CoverFlow)findViewById(R.id.cf_LayoutManage);
       
        btn_edit=(ImageButton)findViewById(R.id.btn_layout_edit);
        btn_delete=(ImageButton)findViewById(R.id.btn_layout_delete);
        btn_new=(ImageButton)findViewById(R.id.btn_layout_new);
        
		// cf.setBackgroundResource(R.drawable.shape);
		cf.setBackgroundColor(Color.BLACK);
		cf.setAdapter(new LayoutAdapter(this));
		LayoutAdapter imageAdapter = new LayoutAdapter(this);
		cf.setAdapter(imageAdapter);
		// cf.setAlphaMode(false);
		// cf.setCircleMode(false);
		cf.setSelection(2, true);
		cf.setAnimationDuration(1000);
		btn_new.setOnClickListener(new OnClickListener(){

			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent i=new Intent(LayoutManageActivity.this,SetLayoutActivity.class);
				startActivity(i);
			}});
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_layout_manage, menu);
        return true;
    }

    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
//        switch (item.getItemId()) {
//            case android.R.id.home:
//                NavUtils.navigateUpFromSameTask(this);
//                return true;
//        }
        return super.onOptionsItemSelected(item);
    }

}
